#ifndef YOOHOO_XMPPCORE_STANZAERRORPARSER_H
#define YOOHOO_XMPPCORE_STANZAERRORPARSER_H

#include "xmppcore/stanza.h"

#include <QtCore/QString>

class QXmlStreamReader;

namespace yoohoo_xmppcore {

class XmppParsingFactory;
class Stanza;;
class StanzaError;

class StanzaErrorParser {
public:
	StanzaErrorParser(XmppParsingFactory* parsingFactory, QXmlStreamReader* reader, QString& xml, Stanza* stanza);
	StanzaError* parse();

private:
	bool isStanzaKindMatched(Stanza::StanzaKind stanzaKind, QString stanzaKindString);
	QString readSenderXml(int start, Stanza::StanzaKind stanzaKind);

private:
	static const int XML_AMENDED_PART_LENGTH;
	XmppParsingFactory* _parsingFactory;
	QXmlStreamReader* _reader;
	QString& _xml;
	Stanza* _stanza;
};

}

#endif
